﻿using System.Windows;
using System.Windows.Controls;

namespace LinkED_WP
{
    public partial class LinkED_POP : UserControl
    {
        public LinkED_POP()
        {
            InitializeComponent();
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if (ip.Text != string.Empty
                && name.Text != string.Empty)
            {
                LinkED_PCItem newPC = new LinkED_PCItem();
                newPC.IPAddress = ip.Text;
                newPC.PCName = name.Text;
                newPC.TCP = true;

                LinkED_DataSource.InsertIntoDataBase(newPC);
                this.CloseMeAsPopup();
            }
            else
            {
                MessageBox.Show("IP地址和计算机名称均不能为空");
            }
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.CloseMeAsPopup();
        }
    }
}
